import request from '@/utils/request'
// 申请所需特殊材料库 API接口
const std_matter_userApi = {
    getUserConfig: '/std_matter_user/config',
    save: '/std_matter_user/save',
    remove: '/std_matter_user/delete',
    matterTree: '/std_category/matterTree',
    batchSave: '/std_matter_user/matters',
}

/**
 * 申请所需特殊材料库分页列表
 * @param {*} body 
 * @returns 
 */
export function getUserConfig(userId) {
    return request({
        url: std_matter_userApi.getUserConfig,
        method: 'post',
        params: { userId: userId }
    })
}

/**
 * 添加或更新记录
 * @param {std_matter_user} body
 * @returns
 */
export function save(body) {
    return request({
        url: std_matter_userApi.save,
        method: 'post',
        data: body
    })
}

/**
 * 添加或更新记录
 * @param {} 
 * @returns
 */
export function remove(id) {
    return request({
        url: std_matter_userApi.remove,
        method: 'post',
        params: { id: id }
    })
}

/**
 * 查询事项树
 * @param {*} provmgr 
 * @returns 
 */
export function matterTree(provmgr) {
    return request({
        url: std_matter_userApi.matterTree,
        method: 'post',
        params: { provmgr: provmgr }
    })
}

/**
 * 添加或更新记录
 * @param {matterIds,userId} 
 * @returns
 */
export function batchSave(matterIds, userId) {
    return request({
        url: std_matter_userApi.batchSave,
        method: 'post',
        params: { matterIds: matterIds, userId: userId }
    })
}